﻿using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Identity;
using Volo.Abp.OpenIddict;
using Volo.Abp.OpenIddict.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement;

namespace Demo.AuthService.Data;

public class AuthServiceDbContext : AbpDbContext<AuthServiceDbContext>
{
    public AuthServiceDbContext(DbContextOptions<AuthServiceDbContext> options)
        : base(options)
    {
    }

    protected override void OnModelCreating(ModelBuilder builder)
    {
        base.OnModelCreating(builder);

        /* Include modules to your migration db context */
        AbpOpenIddictDbProperties.DbTablePrefix = ""; // 1、去掉OpenIddict表前缀
        builder.ConfigureOpenIddict();
        /* Configure your own entities here */

        AbpIdentityDbProperties.DbTablePrefix = ""; // 2、去掉Identity表前缀
        builder.ConfigureIdentity();

        //用户权限表去除前缀
        AbpPermissionManagementDbProperties.DbTablePrefix = ""; // 3、去掉PermissionManagement表前缀
        builder.ConfigurePermissionManagement();

        /* Configure your own entities here */
    }
}
